<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    function showNum(){
        var num = 0;
        function add(){
            for (let index = 0; index < 5; index++) {
                num = num + 1;
            }
            document.write(num);
        }
        return add();
    }
    showNum();
</script>
</html>